// ml:run = $bin < input
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int ex[30];
int main()
{
    memset(ex, 0, sizeof(ex));
    ex[1]=ex[2]=1;
    int a=1, b=2;
    while(b<20){
        ex[a+b]=1;
        a=a+b;
        swap(a, b);
    }
    int t;
    scanf("%d", &t);
    for (int TT=1;TT<=t;TT++){
        int x;
        scanf("%d", &x);
        int ans=0;
        for (int i=1;i<=x;i++)
            if (ex[i]==0) ans++;
        printf("Case #%d: %d\n", TT, ans);
    }
}

